﻿using ByteSite.Quartz;
using Quartz;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace ByteSite.Tasks.Jobs
{
    public class TestJob : NewIJob
    {

        public override void Run(IJobExecutionContext context,ref string result)
        {
            Thread.CurrentThread.IsBackground = true;
            JobDataMap data = context.JobDetail.JobDataMap;
            Console.WriteLine("quartz --{0}", data.GetString("TaskParam"));


            var dc = new Dictionary<string, object>();
            dc.Add("value", DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"));


            DAL.Data dal = new DAL.Data();
            int id = dal.db.Insertable(dc).AS("a_test").ExecuteReturnIdentity();

            result = "success id=" + id;
        }
    }
}